import { Component, OnInit } from '@angular/core';
import { Hero } from './hero';
import { HttpClient, HttpInterceptor, HttpHandler, HttpRequest } from '@angular/common/http';
@Component( {
    selector: 'app-world',
    templateUrl: './world.component.html',
    styleUrls: ['./world.component.css']
} )
export class WorldComponent implements OnInit {

    getpic = { "System": "库存管理系统dd", "Company": "贝特ss", "BillName": "领料单", "KeyId": "217060255" };
    myurl = 'http://localhost:3000/posts/getdata';
    mydata: any;


    constructor( private http: HttpClient ) { }

    ngOnInit() {
    }

    getpicdata() {
        console.log( this.getpic.System + " " + this.getpic.Company + " " + this.getpic.BillName );

    }
    postpicdata() {
        
    }
    
    postdata() {
        this.http.post( this.myurl,{"h":"w"} ).subscribe( data => {
            // Read the result field from the JSON response.
            console.log( data );
        } );
    }

    getdata() {
        this.http.get( this.myurl ).subscribe( data => {
            // Read the result field from the JSON response.
            this.mydata = data;
            console.log( data );
        } );
    }



}
